<template>
  <div class="header">
    <h1>我是Header</h1>
    <p>Count的值是{{ count }}</p>
    <p>价格是{{ price }}</p>
  </div>
</template>

<script>
import { mapState } from "vuex";

export default {
  name: "Header",
  mounted() {
    console.log(this, "你好");
  },
  computed: {
    ...mapState(["count", "price"]),
    //     count(){
    //        return this.$store.state.count
    //     },
    //     price(){
    //         return this.$store.state.price
    //     }
  },
};
</script>

<style scoped>
.header {
  margin: 30px;
  background: yellowgreen;
}
</style>